{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "Posting Batch Extract",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "id" : {
      "type" : "integer",
      "description" : "Unique identifier for each generic extract file than is produced by CMP."
    },
    "jobCode" : {
      "type" : "string",
      "maxLength" : 10,
      "description" : "Unique identfier of the CMP job that produces this extract file. "
    },
    "jobDescription" : {
      "type" : "string",
      "maxLength" : 50,
      "description" : "A short description of the CMP job that produces this extract file. "
    },
    "version" : {
      "type" : "number",
      "minimum" : 0.0,
      "maximum" : 99.99,
      "description" : "The current version of the generic extract file. This must match the corresponding inbound file."
    },
    "interfaceCategory" : {
      "type" : "string",
      "description" : "CMP categorization of the job that produces this extract file."
    },
    "interfaceType" : {
      "type" : "string",
      "description" : "CMP sub-categorization of the job that produces this extract file. "
    },
    "batchDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Timestamp indicating when the batch was created in CMP. "
    },
    "extractLoadDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Timestamp indicating when the generic extract file was created."
    },
    "recordCount" : {
      "type" : "integer",
      "description" : "Total number of transaction records in the extract file. "
    },
    "details" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/PostingBatchDetailExtract"
      }
    }
  },
  "required" : [ "id", "jobCode", "jobDescription", "version", "interfaceCategory", "interfaceType", "batchDateTime", "extractLoadDateTime", "recordCount" ],
  "definitions" : {
    "PostingBatchDetailExtract" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "detailSequence" : {
          "type" : "integer",
          "description" : "Unique identifier of the detail record within the current extract"
        },
        "accountNumber" : {
          "type" : "integer",
          "description" : "Unique identifier of the account in CMP."
        },
        "parentAccountNumber" : {
          "type" : "integer",
          "description" : "Non-zero if AccountNumber is a child account for the purposes of payment collection."
        },
        "amount" : {
          "type" : "number",
          "description" : "Amount of the payment or refund."
        },
        "documentType" : {
          "type" : "string",
          "description" : "Payment or refund indicator."
        },
        "documentNumber" : {
          "type" : "integer",
          "description" : "Unique identifier of the payment/refund transaction."
        },
        "matchingDocumentType" : {
          "type" : "string",
          "description" : "Type of ledger entry to which the payment or refund applies and is being matched to e.g. an invoice."
        },
        "matchingDocumentNumber" : {
          "type" : "integer",
          "description" : "Identifier of the ledger entry to which the payment or refund applies and is being matched."
        },
        "queryAmount" : {
          "type" : "number",
          "description" : "Non-zero where the amount being posted does not exactly match the invoiced amount due."
        },
        "remark" : {
          "type" : "string",
          "maxLength" : 30,
          "description" : "Description of the transaction being posted"
        }
      },
      "required" : [ "detailSequence", "accountNumber", "parentAccountNumber", "amount", "documentType", "documentNumber", "matchingDocumentType", "matchingDocumentNumber", "queryAmount", "remark" ]
    }
  }
}